const path = require('path')
const MODULE_NAME = 'kuyuan_hb'
const resolve = dir => {
  return path.join(__dirname, dir)
}
module.exports = {
  css: {
    loaderOptions: {
      stylus: {
        'resolve url': true,
        'import': [
          './src/theme'
        ]
      }
    }
  },
  pluginOptions: {
    'cube-ui': {
      postCompile: true,
      theme: true
    }
  },
  chainWebpack: config => {
    config.resolve.alias
        .set('@', resolve('src'))
        .set('@c', resolve('src/components'))
        .set('@v', resolve('src/views'))
        .set('@a', resolve('src/assets'))
    config.plugin('html')
        .tap(args => {
          args[0].load = process.env.NODE_ENV === "production" ? '{php echo $_script}' : '<script src=\'https://webapi.amap.com/maps?v=1.4.15&key=8cf05187899e24feccadddef60b77351&plugin=AMap.Geolocation,AMap.Geocoder\'></script>'
          return args
        })
  },
  publicPath: process.env.NODE_ENV === "production"
      ? '../addons/'+MODULE_NAME+'/dist/mobile/'
      : '/',
  outputDir:path.dirname(__dirname) + '/' + MODULE_NAME + '/dist/mobile/',
  indexPath:path.dirname(__dirname) + '/' + MODULE_NAME + '/template/mobile/mobile.html'
}
